]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Workspace/WorkspaceThumbnail: fix Clutter warnings from stacking code
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 19 Jan 2013 01:22:15 +0000 (02:22 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sun, 17 Mar 2013 18:26:13 +0000 (19:26 +0100)
Windows can be restacked at any time, including when the stackAbove
property of the window clone is being dragged, and thus parented to
the uiGroup. To do stacking properly, we need to skip it for the duration
of the drag, and sync it again at the end (which is already done by
mutter because of the workspace change)

https://bugzilla.gnome.org/show_bug.cgi?id=685285

js/ui/workspace.js
js/ui/workspaceThumbnail.js

index 3e954f4b324d42ee7984a45568f8a765414987ff..e2e461d2305baf885012bc2968a694d64886b0c4 100644 (file)
@@ -121,15 +121,33 @@ const WindowClone = new Lang.Class({
             return this._slot;
     },
 
+    // Find the actor just below us, respecting reparenting done
+    // by DND code
+    getActualStackAbove: function() {
+        if (this._stackAbove == null)
+            return null;
+
+        if (this.inDrag || this._zooming) {
+            if (this._stackAbove._delegate)
+                return this._stackAbove._delegate.getActualStackAbove();
+            else
+                return null;
+        } else {
+            return this._stackAbove;
+        }
+    },
+
     setStackAbove: function (actor) {
         this._stackAbove = actor;
         if (this.inDrag)
             // We'll fix up the stack after the drag
             return;
-        if (this._stackAbove == null)
+
+        let actualAbove = this.getActualStackAbove();
+        if (actualAbove == null)
             this.actor.lower_bottom();
         else
-            this.actor.raise(this._stackAbove);
+            this.actor.raise(actualAbove);
     },
 
     destroy: function () {
index 540f3d30df46e85938ca00fc7471f1f0782e720d..4537b92c61caaeeac7ce81b686513244be33eb00 100644 (file)
@@ -62,12 +62,35 @@ const WindowClone = new Lang.Class({
         this.inDrag = false;
     },
 
+    // Find the actor just below us, respecting reparenting done
+    // by DND code
+    getActualStackAbove: function() {
+        if (this._stackAbove == null)
+            return null;
+
+        if (this.inDrag) {
+            if (this._stackAbove._delegate)
+                return this._stackAbove._delegate.getActualStackAbove();
+            else
+                return null;
+        } else {
+            return this._stackAbove;
+        }
+    },
+
     setStackAbove: function (actor) {
         this._stackAbove = actor;
-        if (this._stackAbove == null)
+
+        // Don't apply the new stacking now, it will be applied
+        // when dragging ends and window are stacked again
+        if (actor.inDrag)
+            return;
+
+        let actualAbove = this.getActualStackAbove();
+        if (actualAbove == null)
             this.actor.lower_bottom();
         else
-            this.actor.raise(this._stackAbove);
+            this.actor.raise(actualAbove);
     },
 
     destroy: function () {